#!/bin/bash

echo "========================================"
echo "知识库系统启动脚本"
echo "========================================"
echo

echo "正在启动 PostgreSQL 和 Redis..."
docker-compose up -d

echo
echo "等待数据库启动..."
sleep 10

echo
echo "正在安装依赖..."
pnpm run install:all

echo
echo "正在生成 Prisma 客户端..."
pnpm run db:generate

echo
echo "正在启动所有服务..."
echo "前端展示系统: http://localhost:3000"
echo "后端 API 服务: http://localhost:4000"
echo "后台管理系统: http://localhost:3001"
echo "数据库管理: http://localhost:5050 (pgAdmin)"
echo "Redis 管理: http://localhost:8081"
echo

# 使用 concurrently 启动所有服务
pnpm run dev:all
